﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <title>老师管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit">
    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="/JqueryPlug/dtGrid/jquery.dtGrid.css" rel="stylesheet">
    <link href="/CSS/Base/BaseClass.css?cssver=4" rel="stylesheet" type="text/css" />
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.min.css" rel="stylesheet">
    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/Scripts/avalon.js"></script>
    <script src="/Scripts/jquery-migrate-1.1.0.min.js"></script>
    <script src="/JqueryPlug/dtGrid/jquery.dtGrid.js"></script>
    <script>
        var grid, dtoption;

        //获取主要菜单
        dtoption = {
            lang: 'zh-cn',
            check: false,
            ajaxLoad: false,
            exportFileName: '老师管理列表',
            columns: [
                { id: 'ID', title: '序号', type: 'string', columnClass: 'text-center', hide: true },
                { id: 'LS_LSXM', title: '老师名称', type: 'string', columnClass: 'text-center' },
                { id: 'LS_Type', title: '老师类别', type: 'string', columnClass: 'text-center' },
                { id: 'LS_LSLXFS', title: '老师联系方式', type: 'string', columnClass: 'text-center' },
                { id: 'LS_ZYKC', title: '主要课程', type: 'string', columnClass: 'text-center' },
                { id: 'LS_Address', title: '地点', type: 'string', columnClass: 'text-center' },
                {
                    id: 'Option', title: '查看详细', type: 'string', columnClass: 'text-center', resolution: function (value, record, column, grid, dataNo, columnNo) {
                        var content = '<button class="btn btn-xs btn-default" onclick="LSGLVIEW(\'' + record.ID + '\');"><i class="fa fa-edit"></i>  查看</button>';
                        content += '<button class="btn btn-xs btn-default"  style="margin-left:10px;" onclick="EditLSGL(\'' + record.ID + '\');"><i class="fa fa-edit"></i>  编辑</button>';
                        content += '<button class="btn btn-xs btn-danger"  style="margin-left:10px;"  onclick="DelLSGL(\'' + record.ID + '\',' + dataNo + ')"><i class="fa fa-trash-o"></i>  删除</button>';
                        return content;
                    }
                }],
            gridContainer: 'dtgrid',
            toolbarContainer: 'dtgridTool',
            pageSize: 10,
            pageSizeLimit: [10, 20, 50],
            tools: 'faseQuery',
            onGridComplete: function (grid) {
                var log = '<p>表格加载完成。表格编号：' + grid.option.id + '。</p>';
            }
        };
        var model = avalon.define({
            $id: "APP_LSGL",
            LSGLType: "",
            LSGLContent: "",
            CommonData: [],
            LSGLTypeData: [],
            LSGLADD: function () {
                parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=LSGL", "添加数据", "1000", "600");
            }, GetColumn: function () {
                //获取请假类型
                $.getJSON('/API/FTAPI.ashx?Action=GETCOLUMNLIST', { P1: 11 }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        model.LSGLTypeData = resultData.Result;
                    }
                })
            },
            GetLSGLData: function () {
                $.getJSON('/API/FTAPI.ashx?Action=GETLSGLLIST', { P1: model.LSGLType, P2: model.LSGLContent }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        model.CommonData = resultData.Result;
                        if (dtoption.datas != undefined) {
                            dtoption.originalDatas = model.CommonData;

                        } else {
                            dtoption.datas = model.CommonData;
                            grid = $.fn.DtGrid.init(dtoption);
                        }
                        grid.load()
                    }
                })
            }
        });
        function DelLSGL(Id, rowNumber) {
            if (confirm("确定要删除么？")) {
                $.post("/API/FTAPI.ashx", { Action: "DELLSGLBYID", P1: Id }, function (result) {
                    var jsonresult = $.parseJSON(result)
                    if ($.trim(jsonresult.ErrorMsg) != "") {
                        ComFunJS.winwarning(jsonresult.ErrorMsg);
                    } else {
                        model.CommonData.remove(model.CommonData[rowNumber]);
                        dtoption.originalDatas = model.CommonData;
                        grid.load()
                        parent.ComFunJS.winsuccess("删除成功");
                    }
                })
            }
        }
        function EditLSGL(Id)
        { 
            parent.ComFunJS.winviewform("/View/APPBaseView/APP_ADD_WF.html?FormCode=LSGL&ID=" + Id, "编辑数据", "1000", "600");
        }
        function LSGLVIEW(Id) {
            parent.ComFunJS.winviewform("/View/APPBaseView/APP_LSGL_VIEW.html?ID=" + Id, "查看数据", "1000", "");
        }
        avalon.ready(function () {
            model.GetColumn();
           model.GetLSGLData();
        })
         
    </script>
</head>
<body ms-controller="APP_LSGL">
    <div class="container-fluid maindiv" style="margin-top: 20px" id="dvContent"> 
        <div class="row contentdv" style="margin-left:20px">
            <div class="col-xs-12">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-xs-10">
                                <div class="input-group">
                                    <div class="input-group-addon">查询条件</div>
                                    <select class="form-control" ms-duplex="LSGLType" style="width:30%" ms-change="GetLSGLData()">
                                        <option value="">全部类别</option> 
                                        <option ms-repeat-item="LSGLTypeData" ms-attr-value="item.TypeNO">{{item.TypeNO}}</option> 
                                    </select>
                                    <input id="tbSearch" class="form-control" style="width:70%" type="text" ms-duplex="LSGLContent" placeholder="输入老师姓名、联系方式查询" />
                                    <span class="input-group-btn">
                                        <button class="btn btn-info" ms-click="GetLSGLData()">查询</button>
                                    </span>
                                </div>
                            </div>
                            <div class="col-xs-2">
                            </div>
                        </div>
                    </div>
                </div>
                <div id="dtgrid" style="margin-top:20px"></div>
                <div id="dtgridTool" class="dt-grid-toolbar-container"></div>
            </div>
        </div>
    </div>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.js" type="text/javascript"></script>
    <script src="/Scripts/SZHLCommon.js?jsver=5"></script>
</body>
</html>
